/**版本1.0,生成时间:2017-04-17 14:54:43**/
package com.xbdun.service.bmp.biz;

import java.sql.Timestamp;
import java.util.Map;

import com.xbdun.common.page.Pager;
import com.xbdun.dao.bmp.entity.XbdunRoleDo;
import com.xbdun.facade.bmp.response.system.RoleResponse;



/**
 * 角色
 * @ClassName XbdunRoleService
 * @author 张国涛
 * @2017-04-17 14:54:43
 */
public interface RoleBiz {
	
	/**
	 * 根据主键获取对象
	 * @return {@link XbdunRoleDo}
	 */
	public XbdunRoleDo getXbdunRoleById(long id)throws RuntimeException;
	
	/**
	 * 新增
	 * @param XbdunRoleDo 
	 */
	public Long addXbdunRole(XbdunRoleDo xbdunRoleDo)throws RuntimeException;
	
	/**
	 * 删除数据XbdunRoleDo根据主键
	 * @param id 主键
	 */
	public void delXbdunRoleById(long id)throws RuntimeException;
	
	/**
	 * 判断是否存在,不为null则是存在
	 * @param xbdunRoleDo 新增角色对象
	 * @return int
	 */
	public int existRoleInOrg(Long orgCode, Long xbdunOrgCode, String roleName)throws RuntimeException;
	
	/**
	 * 更新对象属性
	 * @param xbdunRoleDo	更新对象
	 * @param id			对象主键
	 */
	public void updateById(XbdunRoleDo xbdunRoleDo)throws RuntimeException;
	
	/**
	 * 查询分页
	 * @param where			约束条件,键是对象属性其中条件都为and连接
	 * @param orderBy		排序条件
	 * @param pageIndex   	当前索引页
	 * @param pageSize	每页显示条数
	 * @return {@link Pager}
	 * @throws RuntimeException
	 */
	public Pager<RoleResponse> queryPager(Map<String,Object> where,String orderBy,int pageIndex,int pageSize) throws RuntimeException ;

	/**
	 * 通过角色id查询角色所属的机构
	 * @param id
	 * @return
	 */
	public Long getOrgCodeById(long id) throws RuntimeException ;

	/**
	* @Title: deleteRole
	* @Description: 删除角色信息
	* @param id 角色id
	* @param version 版本号
	* @throws Exception
	 */
	public Long deleteRole(Long id, Timestamp version) throws RuntimeException ;

	/**
	* @Title: getVersionById
	* @Description: 获取版本号
	* @param id 角色id
	* @return Timestamp
	 */
	public Timestamp getVersionById(Long id);
}